import axios from 'axios'
import qs from 'qs'

const service = axios.create({
  baseURL: 'http://39.105.78.175/youanmi/',
  timeout: 15000 * 10
})

service.interceptors.request.use(
  config => {
    config.data = qs.stringify(config.data)
    return config
  },
  error => {
    Promise.reject(error)
  }
)

service.interceptors.response.use(
  response => {
    const res = response.data
    return res
  },
  error => {
    Promise.reject(error)
  }
)

export default service
